#!/usr/bin/python
# -*- coding: utf-8 -*-

import requests

#将请求method进行单独封装
class ConfigHttp(object):
    #创建初始化方法，获取请求参数
    def __init__(self, u, m, v):
        self.url = u
        self.method = m
        self.value = v

    #创建外部调用方法
    def run(self):
        if self.method == 'get':
            re = self.__get()
            print(re)
            return re
        elif self.method == 'post':
            re = self.__post()
            return re

    #创建内部调用getfangfa
    def __get(self):
        re = requests.get(url=self.url, params=self.value)
        return re

    #创建内部调用post方法
    def __post(self):
        re = requests.post(url=self.url, data=self.value)
        return re






